import csv
from matplotlib import pyplot as plt
from datetime import datetime

filename = "sitka_weather_2014.csv"
with   open(filename) as file:
    reader = csv.reader(file)
    header_row = next(reader)

    dates = []
    highs = []
    lows=[]
    for row in reader:

        date = datetime.strptime(row[0], "%Y-%m-%d")
        dates.append(date)

        high = int(row[1])
        highs.append(high)

        low=int(row[3])
        lows.append(low)

    figure = plt.figure(dpi=128, figsize=(10, 6))
    plt.plot(dates, highs, c="red")
    plt.plot(dates,lows,c="lightskyblue")
    # 设置图形样式
    plt.title("Daily high temperatures 2014", fontsize=24)
    plt.xlabel('', fontsize=16)
    plt.ylabel("Temperature (F)", fontsize=16)
    plt.tick_params(axis='both', which='major', labelsize=16)

    figure.autofmt_xdate()
    plt.fill_between(dates,highs,lows,facecolor="lightgoldenrodyellow",alpha="0.5")
    plt.show()
